---
title: gluestack-ui Heading Component | Installation, Usage, and API

description: Generates headings from h1 to h6 with different sizes and semantic meanings.

pageTitle: Heading

pageDescription: Generates headings from h1 to h6 with different sizes and semantic meanings.

showHeader: true

tag: RSC
---

import { Meta } from '@storybook/addon-docs';

<Meta title="with-nativewind/Components/Typography/Heading" />

import { Heading, Center } from '../../core-components/nativewind';
import { transformedCode } from '../../utils';
import {
  AppProvider,
  CodePreview,
  Table,
  TableContainer,
  Text,
  InlineCode,
} from '@gluestack/design-system';

import Wrapper from '../../core-components/nativewind/Wrapper';
import { CollapsibleCode, Tabs } from '@gluestack/design-system';

This is an illustration of **Heading** component.

<Wrapper>
  <CodePreview
    showComponentRenderer={ true }
  showArgsController = { false}
  metaData = {{
    code: `
        <Heading>I am a Heading</Heading>
      `,
      transformCode: (code) => {
        return transformedCode(code);
      },
        scope: {
      Wrapper,
        Heading,
      },
    argsType: { },
  }
}
/>
</Wrapper>

<br/>

## Installation

<Tabs value="cli" type="section">
  <Tabs.TabList>
      <Tabs.Tab value="cli">
        <Tabs.TabTitle>CLI</Tabs.TabTitle>
      </Tabs.Tab>
     <Tabs.Tab value="manual">
        <Tabs.TabTitle>Manual</Tabs.TabTitle>
     </Tabs.Tab>
  </Tabs.TabList>
  <Tabs.TabPanels>
    <Tabs.TabPanel value="cli">
<>

### Run the following command:
  ```bash
  npx gluestack-ui add heading
  ```
</>
    </Tabs.TabPanel>
    <Tabs.TabPanel value="manual"> 
<>

### Step 1: Copy and paste the following code into index.tsx in your project.
<CollapsibleCode>

```jsx 
%%-- File: core-components/nativewind/heading/index.tsx --%% 
```
</CollapsibleCode>

> Note: **Step 2 is optional and only required if you want to add support for [React Server Components](https://vercel.com/blog/understanding-react-server-components), You can skip this and jump to Step 3 directly if you don't have this requirement.**

### Step 2(optional): Copy and paste the following code into index.web.tsx in your project.
<CollapsibleCode>

```jsx 
%%-- File: core-components/nativewind/heading/index.web.tsx --%% 
```
</CollapsibleCode>

### Step 3: Copy and paste the following code into styles.tsx in your project.
<CollapsibleCode>

```jsx 
%%-- File: core-components/nativewind/heading/styles.tsx --%% 
```
</CollapsibleCode>

### Step 4: Update the import paths to match your project setup.
</>
    </Tabs.TabPanel>
  </Tabs.TabPanels>
</Tabs>

## API Reference

To use this component in your project, include the following import statement in your file.

```jsx
import { Heading } from '@/components/ui/heading';
```

```jsx
export default () => <Heading />;
```

### Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

#### Heading

It inherits all the properties of @expo/html-elements's [H1](https://github.com/expo/expo/tree/main/packages/html-elements) component.

### Props

#### Heading

Heading component is created using H1 component from @expo/html-elements. It extends all the props supported by [Expo HTML Heading Elements](https://www.npmjs.com/package/@expo/html-elements/v/0.0.5), [utility props](/ui/docs/styling/utility-and-sx-props) and the props mentioned below.

<>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Name</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Value</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Default</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isTruncated</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>true | false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>bold</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>true | false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>underline</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>true | false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>strikeThrough</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>true | false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>sub</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>true | false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>italic</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>true | false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>highlight</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>true | false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>size</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>
              5xl | 4xl | 3xl | 2xl | xl | lg | md | sm | xs
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>md</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</>

### Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

#### Heading Sizes

Heading component offers a range of sizes, including `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`, and `5xl`, allowing users to customize the size of the heading according to their design requirements.

<Wrapper>
  <CodePreview
    _rendererWrapper={{ py: '$2.5' }}
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
        function App() {
          const sizes = [
            'xs',
            'sm',
            'md',
            'lg',
            'xl',
            '2xl',
            '3xl',
            '4xl',
            '5xl',
          ];
          return (
              <Center>
                {sizes.map((size) => (
                  <Heading size={size}>{size}</Heading>
                ))}
              </Center>
          );
        };
      `,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'App');
      },
      scope: { Wrapper, Center, Heading },
      argsType: {},
    }}
  />
</Wrapper>